<template>
	<div style="padding-top: 1rpx;">
		<div class="lots_c">
			<div class="detail_image">
				<image :src="data.info_image"></image>
			</div>
			<div class="btn_box" v-if="isNeglect">
				<!-- <img @click="next" src="../../../static/drawlots/agin_draw.png"></img> -->
				<view class="next" @click="next">
					<view class="">
						再次抽签
					</view>
					<view class="">
						还可求签<span>{{data.chance}}</span>次
					</view>
				</view>
				<view class="img" @click="Lott" v-if="prize_open">
					<view class="">
						签签有利
					</view>
					<view class="" >
						剩余<span>{{chanceData.lottery}}</span>次抽奖机会
					</view>
				</view>
			</div>
			<div class="btn_box" v-else>
				<view class="img" @click="share">
					 <view class="">
					 	分享
					 </view>
				</view>
			</div>
		</div>
		
	</div>
</template>

<script>
	import {chance} from '@/api/api'
	export default{
		props:{
			data:{},
			isNeglect:{
				default:true
			}
		},
		data(){
			return{
				chanceData:{},
				prize_open:false
			}
		},
		methods:{
			next(){
				this.$emit('next')
			},
			Lott(){
				this.$emit('lott')
			},
			share(){
				this.$emit('share')
			},
			close(){
				this.$emit('close')
			},
			initWorksChance(){
				chance({actid:this.$route.query.id}).then(res=>{
					this.chanceData = res.data
				})
			},
		},
		mounted(){
			this.initWorksChance()
			let data = JSON.parse(uni.getStorageSync(this.$route.query.id+'ActivityData'))
			this.prize_open = data.settings.prize_open
		}
	}
</script>

<style lang="scss" scoped>
	.lots_c{
		position: absolute;
		left: 0%;
		top: 46%;
		width: 750rpx;
		height: 906rpx;
		margin: -500rpx 0 0 0 ;
		.detail_image{
			width: 100%;
			text-align: center;
			image{
				width: 480rpx;
				height: 906rpx;
			}
		}
		.btn_box{
			display: flex;
			justify-content: center;
			align-items: center;
			position: relative;
			height: 90rpx;
			margin-top: 50rpx;
			width: 750rpx;
			.next{
				margin: 0 10rpx;
				width: 286rpx;
				height: 86rpx;
				background: #FFF6DB;
				border-radius: 45rpx;
				border: 2rpx solid #CC1313;
				display: flex;
				flex-direction: column;
				justify-content: center;
				align-items: center;
				&>view:first-child{
					height: 42rpx;
					font-size: 30rpx;
					font-family: PingFang SC, PingFang SC;
					font-weight: bold;
					color: #E3291C;
				}
				&>view:nth-child(2){
					height: 28rpx;
					font-size: 20rpx;
					font-family: PingFang SC, PingFang SC;
					font-weight: 400;
					color: #E3291C;
					span{
						color: #E3291C;
					}
				}
			}
			.img{
				width: 290rpx;
				height: 90rpx;
				margin: 0 10rpx;
				background: url('../../../static/drawlots/lott.png');
				background-size: 100% 100%;
				display: flex;
				flex-direction: column;
				justify-content: center;
				align-items: center;
				&>view:first-child{
					height: 42rpx;
					font-size: 30rpx;
					font-family: PingFang SC, PingFang SC;
					font-weight: bold;
					color: #FFE7BE;
				}
				&>view:nth-child(2){
					height: 28rpx;
					font-size: 20rpx;
					font-family: PingFang SC, PingFang SC;
					font-weight: 400;
					color: #FFB0A7;
					span{
						color: #FFE7BE;
					}
				}
			}
		}
		
		
	}
</style>